﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MongoDB.Driver;
using SignatureWebApi.Models;

namespace SignatureWebApi.Controllers
{
    /// <summary>
    /// 任务数据控制器类
    /// </summary>
    [RoutePrefix("api/Mission")]
    [Authorize(Roles = "DataRead")]
    public class MissionController : ApiController
    {
        /// <summary>
        /// 获取航班任务列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [Route("GetStaffMissionList")]
        public HttpResponseMessage GetStaffMissionList([FromUri] string test)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);

            }
            var mongoDb = MongoDbInstanceStore.DataStoreInstance;

            var dBdata = "";
            return Request.CreateResponse(HttpStatusCode.OK, dBdata);
            //return dBdata;
            //return Request.CreateResponse(HttpStatusCode.OK, returnData);
        }
        /// <summary>
        /// 分配人到指定区域
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [Route("SetStaffArea")]
        public HttpResponseMessage SetStaffArea(SetStaffAreaModel model)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);

            }
            var mongoDb = MongoDbInstanceStore.DataStoreInstance;
            var filterBuilder = Builders<SetStaffAreaModel>.Filter;
            var updateCotent = Builders<SetStaffAreaModel>.Update;
            var content=updateCotent.Set("User", "");

            var dBdata = "";
            return Request.CreateResponse(HttpStatusCode.OK, dBdata);
            //return dBdata;
            //return Request.CreateResponse(HttpStatusCode.OK, returnData);
        }
    }
}
